using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace View.Replay
{
	public class ReplaySettingDlg : Form
	{
		private IContainer components = null;
		private ComboBox cmbReplayDataLen;
		private Label ultraLabel1;
		private Label ultraLabel2;
		private Label ultraLabel3;
		private Button btnCancel;
		private Button btnOk;
		private Label ultraLabel4;
		private Button btnSetUnBufferedColor;
		private Button btnSetBufferedColor;
		private Button btnSliderColor;
		private Label ultraLabel5;
		public static bool IsTimeLenCanBeSet;
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.components != null)
			{
				this.components.Dispose();
			}
			base.Dispose(disposing);
		}
		private void InitializeComponent()
		{
			this.cmbReplayDataLen = new ComboBox();
			this.ultraLabel1 = new Label();
			this.ultraLabel2 = new Label();
			this.ultraLabel3 = new Label ();
			this.btnCancel = new Button();
			this.btnOk = new Button();
			this.ultraLabel4 = new Label();
			this.btnSetUnBufferedColor = new Button();
			this.btnSetBufferedColor = new Button();
			this.btnSliderColor = new Button();
			this.ultraLabel5 = new Label();
			((ISupportInitialize)this.cmbReplayDataLen).BeginInit();
			base.SuspendLayout();
			this.cmbReplayDataLen.Location = new Point(112, 21);
			this.cmbReplayDataLen.Name = "cmbReplayDataLen";
			this.cmbReplayDataLen.Size = new Size(95, 21);
			this.cmbReplayDataLen.TabIndex = 0;
			this.ultraLabel1.Location = new Point(27, 26);
			this.ultraLabel1.Name = "ultraLabel1";
			this.ultraLabel1.Size = new Size(80, 17);
			this.ultraLabel1.TabIndex = 1;
			this.ultraLabel1.Text = "回放时间长度";
			this.ultraLabel2.Location = new Point(16, 88);
			this.ultraLabel2.Name = "ultraLabel2";
			this.ultraLabel2.Size = new Size(91, 19);
			this.ultraLabel2.TabIndex = 1;
			this.ultraLabel2.Text = "已缓冲数据颜色";
			this.ultraLabel3.Location = new Point(213, 25);
			this.ultraLabel3.Name = "ultraLabel3";
			this.ultraLabel3.Size = new Size(33, 18);
			this.ultraLabel3.TabIndex = 2;
			this.ultraLabel3.Text = "分钟";
			this.btnCancel.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
            //this.btnCancel.DialogResult = DialogResult.Cancel;
			this.btnCancel.Location = new Point(132, 154);
			this.btnCancel.Name = "btnCancel";
			this.btnCancel.Size = new Size(75, 23);
			this.btnCancel.TabIndex = 3;
			this.btnCancel.Text = "取消";
			this.btnCancel.Click += new EventHandler(this.btnCancel_Click);
			this.btnOk.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.btnOk.Location = new Point(51, 154);
			this.btnOk.Name = "btnOk";
			this.btnOk.Size = new Size(75, 23);
			this.btnOk.TabIndex = 4;
			this.btnOk.Text = "确定";
			this.btnOk.Click += new EventHandler(this.btnOk_Click);
			this.ultraLabel4.Location = new Point(17, 63);
			this.ultraLabel4.Name = "ultraLabel4";
			this.ultraLabel4.Size = new Size(91, 19);
			this.ultraLabel4.TabIndex = 1;
			this.ultraLabel4.Text = "未缓冲数据颜色";
			this.btnSetUnBufferedColor.BackColor = Color.FromArgb(192, 255, 192);
			this.btnSetUnBufferedColor.FlatStyle = FlatStyle.Flat;
			this.btnSetUnBufferedColor.Location = new Point(112, 60);
			this.btnSetUnBufferedColor.Name = "btnSetUnBufferedColor";
			this.btnSetUnBufferedColor.Size = new Size(94, 23);
			this.btnSetUnBufferedColor.TabIndex = 5;
			this.btnSetUnBufferedColor.UseVisualStyleBackColor = false;
			this.btnSetUnBufferedColor.Click += new EventHandler(this.btnSetColor_Click);
			this.btnSetBufferedColor.BackColor = Color.Lime;
			this.btnSetBufferedColor.FlatStyle = FlatStyle.Flat;
			this.btnSetBufferedColor.Location = new Point(112, 84);
			this.btnSetBufferedColor.Name = "btnSetBufferedColor";
			this.btnSetBufferedColor.Size = new Size(94, 23);
			this.btnSetBufferedColor.TabIndex = 5;
			this.btnSetBufferedColor.UseVisualStyleBackColor = false;
			this.btnSetBufferedColor.Click += new EventHandler(this.btnSetColor_Click);
			this.btnSliderColor.BackColor = Color.Lime;
			this.btnSliderColor.FlatStyle = FlatStyle.Flat;
			this.btnSliderColor.Location = new Point(112, 110);
			this.btnSliderColor.Name = "btnSliderColor";
			this.btnSliderColor.Size = new Size(94, 23);
			this.btnSliderColor.TabIndex = 7;
			this.btnSliderColor.UseVisualStyleBackColor = false;
			this.btnSliderColor.Click += new EventHandler(this.btnSetColor_Click);
			this.ultraLabel5.Location = new Point(50, 112);
			this.ultraLabel5.Name = "ultraLabel5";
			this.ultraLabel5.Size = new Size(56, 19);
			this.ultraLabel5.TabIndex = 6;
			this.ultraLabel5.Text = "滑块颜色";
			base.AcceptButton = this.btnOk;
			base.AutoScaleDimensions = new SizeF(6f, 12f);
            //base.AutoScaleMode = AutoScaleMode.Font;
			base.CancelButton = this.btnCancel;
			base.ClientSize = new Size(256, 189);
			base.Controls.Add(this.btnSliderColor);
			base.Controls.Add(this.ultraLabel5);
			base.Controls.Add(this.btnSetBufferedColor);
			base.Controls.Add(this.btnSetUnBufferedColor);
			base.Controls.Add(this.btnOk);
			base.Controls.Add(this.btnCancel);
			base.Controls.Add(this.cmbReplayDataLen);
			base.Controls.Add(this.ultraLabel3);
			base.Controls.Add(this.ultraLabel4);
			base.Controls.Add(this.ultraLabel2);
			base.Controls.Add(this.ultraLabel1);
            //base.FormBorderStyle = FormBorderStyle.FixedToolWindow;
			base.Name = "ReplaySettingDlg";
			base.StartPosition = FormStartPosition.CenterScreen;
			this.Text = "回放设置";
			base.Load += new EventHandler(this.ReplaySettingDlg_Load);
			((ISupportInitialize)this.cmbReplayDataLen).EndInit();
			base.ResumeLayout(false);
			base.PerformLayout();
		}
		public ReplaySettingDlg()
		{
			this.InitializeComponent();
		}
		private void ReplaySettingDlg_Load(object sender, EventArgs e)
		{
            //ReplaySettingParam setting = new ReplaySettingParam();
            this.cmbReplayDataLen.DropDownStyle = ComboBoxStyle.DropDownList;
			this.cmbReplayDataLen.Items.Clear();
			this.cmbReplayDataLen.DataSource = new int[]
			{
				5,
				10,
				20,
				30,
				60,
				120
			};
            //this.cmbReplayDataLen.Text = setting.ReplayTimeLen.ToString();
            //this.btnSetUnBufferedColor.BackColor = setting.UnBufferedDataColor;
            //this.btnSetBufferedColor.BackColor = setting.BufferedDataColor;
            //this.btnSliderColor.BackColor = setting.SliderColor;
            //if ((CSMApplication.App as CSMReplayApp).ReplayMode == ReplayMode.ZxFile)
            //{
            //    this.cmbReplayDataLen.Enabled = false;
            //}
			ReplaySettingDlg.IsTimeLenCanBeSet = this.cmbReplayDataLen.Enabled;
		}
		private void btnSetColor_Click(object sender, EventArgs e)
		{
			Button button = sender as Button;
			if (button != null)
			{
				ColorDialog colorDialog = new ColorDialog();
				if (colorDialog.ShowDialog() == DialogResult.OK)
				{
					button.BackColor = colorDialog.Color;
				}
			}
		}
		private void btnOk_Click(object sender, EventArgs e)
		{
            //ReplaySettingParam setting = new ReplaySettingParam();
            //setting.ReplayTimeLen = (int)this.cmbReplayDataLen.SelectedItem;
            //setting.BufferedDataColor = this.btnSetBufferedColor.BackColor;
            //setting.UnBufferedDataColor = this.btnSetUnBufferedColor.BackColor;
            //setting.SliderColor = this.btnSliderColor.BackColor;
            //setting.Save();
			base.DialogResult = DialogResult.OK;
			base.Close();
		}
		private void btnCancel_Click(object sender, EventArgs e)
		{
			base.DialogResult = DialogResult.Cancel;
			base.Close();
		}
	}
}
